#!/usr/bin/env python
#coding=utf-8

# 类
class FooClass(object):
	""" optional documentatial string """
	version = 0.1
	def __init__(self, nm="John Doe"):#实例创建后调用的第一个方法
		self.name = nm
		print 'Created a class instance for',nm
	def showname(self):
		print 'Your name is ', self.name
		print 'My name is', self.__class__.__name__
	def showver(self):
		print self.version
	def addMe2Me(self, x):
		return x+x


fool = FooClass()
fool.showname()
fool2 = FooClass("hello ")
fool2.showname()
# 返回对象的类型
ss = "170"
print type(ss)
print int(ss)
print str(int(ss))
print len(ss)
# 显示 属性
print dir(ss)

ans = [1,2,3,4]
avg = 0.0
for i in ans:
	avg += i
avg = avg / 4
print avg

# 测试python换行
print '我喜欢你 很久了\
不知道你知不知道'
# 元组赋值
x, y, z = 1, 2, 3
print x, y, z

# python 交换两个
x, y = y, x
print x, y, z

# _xxx 类中私有变量名称

# 删除对象释放内存
x = 100
y = x
del y






